<%@ page contentType="text/html;charset=UTF-8"%> 
<%@ page import="com.yfeng.user.model.*" %>
<%
	Permission permission=(Permission)request.getAttribute("permission");
	String method=(String)request.getAttribute("method");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>权限管理</title>
        <link href="${pageContext.request.contextPath}/common/themes/App_Themes/default/Style.css" rel="stylesheet" type="text/css" />
        <script src="${pageContext.request.contextPath}/common/js/jquery-1.4.2.min.js"></script>
    </head>
<script>
    $(document).ready(function(){
   $("#submit").submit(function(){

                flag="y";
                $("input[auth=y]").each(function(){
                    if($(this).attr("isnull")=="n" && $(this).val()=="")
                    {

                        $(this).css("border-color","red").attr("error","该字段不能为空").attr("title","该字段不能为空");
                    }
                    else if($(this).attr("isnum")=="y" && isNaN($(this).val()))
                    {
                             $(this).css("border-color","red").attr("error","该字段必须是数字").attr("title","该字段必须是数字");
                    }
                    else{
                        //$(this).css("border-color","").attr("error","").next().text("");//清空错误信息
                        $(this).css("border-color","").attr("error","");
                    }
                    if($(this).attr("error").length>0)
                        flag="n";
                });

                 if(flag!="y"){
                     return false;
                }


        });
    });
    </script>
       <style>
           .txtinput{
	height:15px;
	width:120px;
	border:1px silver solid;
       }
       </style>
    <body class="layout_body">
        <form action="${pageContext.request.contextPath}/admin/addpermission.do" method="post" >
            <input type="hidden" name="method" value="<%=method %>"/>
            <input type="hidden" name="id" value="${permission.id}"/>
            <div id="layout_container">

                <div id="layout_mainContent">
                    <!-- begin #layout_mainContent -->
                    <!-- begin #box_table?????grid -->
                    <!-- end #box_table -->

                    <!-- begin #box_table -->
                    <!-- end #box_table -->

                    <!-- begin #dialog_table -->
                    <table   border="0" cellspacing="0" cellpadding="0" class="dialog_table">
                        <tr>
                            <td class="dialog_top_left"></td>
                            <td class="dialog_top_center">权限</td>
                            <td class="dialog_top_right"></td>
                        </tr>
                        <tr>
                            <td class="dialog_left"></td>
                            <td class="tcl tdPadding">

                                <div class="dialog_content">

                                    <table class="form_table"><!--?????-->
                                        <tr>
                                            <td class="tar">
                                                权限名
                                            </td>
                                            <td class="tal">
                                                <input type="text" name="name" id="name" value="${permission.name }" auth="y" isnull="n"  error="" class="txtinput"/>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td class="tar">
                                                值
                                            </td>
                                            <td class="tal">
                                                <input type="text" name="link" id="link" value="${permission.link}"  auth="y" isnull="n" isnum="y"  error=""  class="txtinput"/>
                                            </td>
                                        </tr>


                                       
                                       
                                    </table><!--?????-->

                                </div>

                                <!-- ???-->
                                <div class="tac">
                                    <input name="submit" type="submit" class="button_original_yellow" id="submit"  value="提交"/>

                                    <input name="reset" type="button" class="button_original"  value="关闭" id="reset" onclick="window.close()"/>
                                </div>
                                <!-- ???-->

                            </td>
                            <td class="dialog_right"></td>
                        </tr>
                        <tr>
                            <td class="dialog_bottom_left"></td>
                            <td class="dialog_bottom_center"></td>
                            <td class="dialog_bottom_right"></td>
                        </tr>
                    </table>
                    <!-- end #dialog_table -->
                    <!-- end #layout_mainContent -->
                </div>

            </div>
        </form>
    </body>
</html>
